<?php

/**
 * Shop form base class.
 *
 * @package    form
 * @subpackage shop
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseShopForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'shop_id'            => new sfWidgetFormInputHidden(),
      'user_id'            => new sfWidgetFormDoctrineChoice(array('model' => 'User', 'add_empty' => false)),
      'province_id'        => new sfWidgetFormDoctrineChoice(array('model' => 'Province', 'add_empty' => false)),
      'amphur_id'          => new sfWidgetFormDoctrineChoice(array('model' => 'Amphur', 'add_empty' => false)),
      'restaurant_type_id' => new sfWidgetFormDoctrineChoice(array('model' => 'RestaurantType', 'add_empty' => false)),
      'felling_id'         => new sfWidgetFormDoctrineChoice(array('model' => 'Felling', 'add_empty' => false)),
      'status'             => new sfWidgetFormInput(),
      'shop_name'          => new sfWidgetFormInput(),
      'open_time'          => new sfWidgetFormInput(),
      'close_time'         => new sfWidgetFormInput(),
      'location_detail'    => new sfWidgetFormTextarea(),
      'location_map_x'     => new sfWidgetFormInput(),
      'location_map_y'     => new sfWidgetFormInput(),
      'location_map_z'     => new sfWidgetFormInput(),
      'carpark'            => new sfWidgetFormInput(),
      'promotion'          => new sfWidgetFormTextarea(),
      'point_total'        => new sfWidgetFormInput(),
      'point_count'        => new sfWidgetFormInput(),
      'point_avg'          => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'shop_id'            => new sfValidatorDoctrineChoice(array('model' => 'Shop', 'column' => 'shop_id', 'required' => false)),
      'user_id'            => new sfValidatorDoctrineChoice(array('model' => 'User')),
      'province_id'        => new sfValidatorDoctrineChoice(array('model' => 'Province')),
      'amphur_id'          => new sfValidatorDoctrineChoice(array('model' => 'Amphur')),
      'restaurant_type_id' => new sfValidatorDoctrineChoice(array('model' => 'RestaurantType')),
      'felling_id'         => new sfValidatorDoctrineChoice(array('model' => 'Felling')),
      'status'             => new sfValidatorInteger(),
      'shop_name'          => new sfValidatorString(array('max_length' => 255)),
      'open_time'          => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'close_time'         => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'location_detail'    => new sfValidatorString(array('required' => false)),
      'location_map_x'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'location_map_y'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'location_map_z'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'carpark'            => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'promotion'          => new sfValidatorString(array('required' => false)),
      'point_total'        => new sfValidatorInteger(array('required' => false)),
      'point_count'        => new sfValidatorInteger(array('required' => false)),
      'point_avg'          => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('shop[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Shop';
  }

}
